function PopulateUI()
{
  variable int iterCnt=1
  do
  {
    variable float tempAdd
    tempAdd:Set[0.00]
    ;echo --- hunt UI --- ${huntWP[${iterCnt}].X} , ${huntWP[${iterCnt}].Y}
    if ${huntWP[${iterCnt}].X}!=0 && ${huntWP[${iterCnt}].Y}!=0
      UIElement[WP${iterCnt}Button@HuntLocFrame@Loc@HuntTabs@HuntFrame@Hunt@EZVGTabs@ezvg]:SetText["( ${Math.Calc[${huntWP[${iterCnt}].X}].Int} , ${Math.Calc[${huntWP[${iterCnt}].Y}].Int} )"]
    elseif ${iterCnt}==1
      UIElement[WP${iterCnt}Button@HuntLocFrame@Loc@HuntTabs@HuntFrame@Hunt@EZVGTabs@ezvg]:SetText["C A M P"]
    else
      UIElement[WP${iterCnt}Button@HuntLocFrame@Loc@HuntTabs@HuntFrame@Hunt@EZVGTabs@ezvg]:SetText["WP_${iterCnt} - OPEN"]
    if ${huntDist[${iterCnt}]}>0
      UIElement[WP${iterCnt}RangeSliderValue@HuntLocFrame@Loc@HuntTabs@HuntFrame@Hunt@EZVGTabs@ezvg]:SetText[${huntDist[${iterCnt}]}]
    do
    {
      UIElement[WP${iterCnt}Pause@HuntLocFrame@Loc@HuntTabs@HuntFrame@Hunt@EZVGTabs@ezvg]:AddItem[${tempAdd}]
      if ${huntWPPause[${iterCnt}]}==${tempAdd}
        UIElement[WP${iterCnt}Pause@HuntLocFrame@Loc@HuntTabs@HuntFrame@Hunt@EZVGTabs@ezvg]:SetSelection[${UIElement[WP${iterCnt}Pause@HuntLocFrame@Loc@HuntTabs@HuntFrame@Hunt@EZVGTabs@ezvg].Items}]
      tempAdd:Inc[0.500]
    }
    while ${tempAdd}<10.0
    UIElement[WP${iterCnt}Pause@HuntLocFrame@Loc@HuntTabs@HuntFrame@Hunt@EZVGTabs@ezvg]:AddItem[999]
    if ${huntWPPause[${iterCnt}]}==999
      UIElement[WP${iterCnt}Pause@HuntLocFrame@Loc@HuntTabs@HuntFrame@Hunt@EZVGTabs@ezvg]:SetSelection[${UIElement[WP${iterCnt}Pause@HuntLocFrame@Loc@HuntTabs@HuntFrame@Hunt@EZVGTabs@ezvg].Items}]
    if ${iterCnt}<=6
      UIElement[GroupHealNumInRng@OptionsHealFrame@Heal@OptionsTabs@OptionsFrame@Options@EZVGTabs@ezvg]:AddItem[${iterCnt}]
    if ${healGrpMinInRng}==${iterCnt}
      UIElement[GroupHealNumInRng@OptionsHealFrame@Heal@OptionsTabs@OptionsFrame@Options@EZVGTabs@ezvg]:SetSelection[${iterCnt}]
    iterCnt:Inc[1]
  }
  while ${iterCnt}<=10
  iterCnt:Set[0]
  do
  {
    if ${iterCnt}<4
    {
      UIElement[NumMinionsToSummon@OptionsPetFrame@Pet@ClassTabs@ClassFrame@Class@EZVGTabs@ezvg]:AddItem[${iterCnt}]
      if ${numMinionsToSummon.Equal[${iterCnt}]}
        UIElement[NumMinionsToSummon@OptionsPetFrame@Pet@ClassTabs@ClassFrame@Class@EZVGTabs@ezvg]:SetSelection[${UIElement[SummonMinion@OptionsPetFrame@Pet@ClassTabs@ClassFrame@Class@EZVGTabs@ezvg].Items}]
    }
    if ${iterCnt}<25
    {
      UIElement[AERange@OptionsDetrFrame@Detr@OptionsTabs@OptionsFrame@Options@EZVGTabs@ezvg]:AddItem[${iterCnt}]
      if ${AEDist.Equal[${iterCnt}]}
        UIElement[AERange@OptionsDetrFrame@Detr@OptionsTabs@OptionsFrame@Options@EZVGTabs@ezvg]:SetSelection[${UIElement[AERange@OptionsDetrFrame@Detr@OptionsTabs@OptionsFrame@Options@EZVGTabs@ezvg].Items}]
    }
    UIElement[MinSpecPts@SpecPtsFrame@SpecPts@ClassTabs@ClassFrame@Class@EZVGTabs@ezvg]:AddItem[${iterCnt}]
    if ${minSpecPts}==${iterCnt}
      UIElement[MinSpecPts@SpecPtsFrame@SpecPts@ClassTabs@ClassFrame@Class@EZVGTabs@ezvg]:SetSelection[${UIElement[MinSpecPts@SpecPtsFrame@SpecPts@ClassTabs@ClassFrame@Class@EZVGTabs@ezvg].Items}]
    UIElement[MinSpecPtsBurn@SpecPtsFrame@SpecPts@ClassTabs@ClassFrame@Class@EZVGTabs@ezvg]:AddItem[${iterCnt}]
    if ${minSpecPtsBurn}==${iterCnt}
      UIElement[MinSpecPtsBurn@SpecPtsFrame@SpecPts@ClassTabs@ClassFrame@Class@EZVGTabs@ezvg]:SetSelection[${UIElement[MinSpecPtsBurn@SpecPtsFrame@SpecPts@ClassTabs@ClassFrame@Class@EZVGTabs@ezvg].Items}]
    iterCnt:Inc[1]
  }
  while ${iterCnt}<=60
  iterCnt:Set[0]
  do
  {
    UIElement[MinLevelRange@HuntBotFrame@Bot@HuntTabs@HuntFrame@Hunt@EZVGTabs@ezvg]:AddItem[${iterCnt}]
    if ${minLvlPull.Equal[${iterCnt}]}
      UIElement[MinLevelRange@HuntBotFrame@Bot@HuntTabs@HuntFrame@Hunt@EZVGTabs@ezvg]:SetSelection[${UIElement[MinLevelRange@HuntBotFrame@Bot@HuntTabs@HuntFrame@Hunt@EZVGTabs@ezvg].Items}]
    UIElement[MaxLevelRange@HuntBotFrame@Bot@HuntTabs@HuntFrame@Hunt@EZVGTabs@ezvg]:AddItem[${iterCnt}]
    if ${maxLvlPull.Equal[${iterCnt}]}
      UIElement[MaxLevelRange@HuntBotFrame@Bot@HuntTabs@HuntFrame@Hunt@EZVGTabs@ezvg]:SetSelection[${UIElement[MaxLevelRange@HuntBotFrame@Bot@HuntTabs@HuntFrame@Hunt@EZVGTabs@ezvg].Items}]
    iterCnt:Inc[1]
  }
  while ${iterCnt}<=100
  if ${Me.Form}>0
  {
    echo @@@ UI @@@@ populating STANCE dropdowns
    variable int iterInt
    iterInt:Set[1]
    do
    {
      ;echo --- ezvg main loop --- ${Me.Form} - ${Me.Form[${iterInt}].Name} - ${Me.Form[${iterInt}](exists)} 
      if ${Me.Form[${iterInt}](exists)}
      {
        UIElement[MeleeStance@OptionsStanceFrame@Stance@OptionsTabs@OptionsFrame@Options@EZVGTabs@ezvg]:AddItem[${Me.Form[${iterInt}].Name}]
        if ${Me.Form[${iterInt}].Name.Equal[${meleeStance}]}
          UIElement[MeleeStance@OptionsStanceFrame@Stance@OptionsTabs@OptionsFrame@Options@EZVGTabs@ezvg]:SetSelection[${UIElement[MeleeStance@OptionsStanceFrame@Stance@OptionsTabs@OptionsFrame@Options@EZVGTabs@ezvg].Items}]
        UIElement[SpellStance@OptionsStanceFrame@Stance@OptionsTabs@OptionsFrame@Options@EZVGTabs@ezvg]:AddItem[${Me.Form[${iterInt}].Name}]
        if ${Me.Form[${iterInt}].Name.Equal[${spellStance}]}
          UIElement[SpellStance@OptionsStanceFrame@Stance@OptionsTabs@OptionsFrame@Options@EZVGTabs@ezvg]:SetSelection[${UIElement[SpellStance@OptionsStanceFrame@Stance@OptionsTabs@OptionsFrame@Options@EZVGTabs@ezvg].Items}]
        UIElement[HealStance@OptionsStanceFrame@Stance@OptionsTabs@OptionsFrame@Options@EZVGTabs@ezvg]:AddItem[${Me.Form[${iterInt}].Name}]
        if ${Me.Form[${iterInt}].Name.Equal[${healStance}]}
          UIElement[HealStance@OptionsStanceFrame@Stance@OptionsTabs@OptionsFrame@Options@EZVGTabs@ezvg]:SetSelection[${UIElement[HealStance@OptionsStanceFrame@Stance@OptionsTabs@OptionsFrame@Options@EZVGTabs@ezvg].Items}]
        UIElement[TankStance@OptionsStanceFrame@Stance@OptionsTabs@OptionsFrame@Options@EZVGTabs@ezvg]:AddItem[${Me.Form[${iterInt}].Name}]
        if ${Me.Form[${iterInt}].Name.Equal[${tankStance}]}
          UIElement[TankStance@OptionsStanceFrame@Stance@OptionsTabs@OptionsFrame@Options@EZVGTabs@ezvg]:SetSelection[${UIElement[TankStance@OptionsStanceFrame@Stance@OptionsTabs@OptionsFrame@Options@EZVGTabs@ezvg].Items}]
        UIElement[EvasiveStance@OptionsStanceFrame@Stance@OptionsTabs@OptionsFrame@Options@EZVGTabs@ezvg]:AddItem[${Me.Form[${iterInt}].Name}]
        if ${Me.Form[${iterInt}].Name.Equal[${evasiveStance}]}
          UIElement[EvasiveStance@OptionsStanceFrame@Stance@OptionsTabs@OptionsFrame@Options@EZVGTabs@ezvg]:SetSelection[${UIElement[EvasiveStance@OptionsStanceFrame@Stance@OptionsTabs@OptionsFrame@Options@EZVGTabs@ezvg].Items}]
        UIElement[BurnStance@OptionsStanceFrame@Stance@OptionsTabs@OptionsFrame@Options@EZVGTabs@ezvg]:AddItem[${Me.Form[${iterInt}].Name}]
        if ${Me.Form[${iterInt}].Name.Equal[${burnStance}]}
          UIElement[BurnStance@OptionsStanceFrame@Stance@OptionsTabs@OptionsFrame@Options@EZVGTabs@ezvg]:SetSelection[${UIElement[BurnStance@OptionsStanceFrame@Stance@OptionsTabs@OptionsFrame@Options@EZVGTabs@ezvg].Items}]
        UIElement[CanniStance@OptionsStanceFrame@Stance@OptionsTabs@OptionsFrame@Options@EZVGTabs@ezvg]:AddItem[${Me.Form[${iterInt}].Name}]
        if ${Me.Form[${iterInt}].Name.Equal[${canniStance}]}
          UIElement[CanniStance@OptionsStanceFrame@Stance@OptionsTabs@OptionsFrame@Options@EZVGTabs@ezvg]:SetSelection[${UIElement[CanniStance@OptionsStanceFrame@Stance@OptionsTabs@OptionsFrame@Options@EZVGTabs@ezvg].Items}]
        UIElement[SpecPtsStance@SpecPtsFrame@SpecPts@ClassTabs@ClassFrame@Class@EZVGTabs@ezvg]:AddItem[${Me.Form[${iterInt}].Name}]
        if ${Me.Form[${iterInt}].Name.Equal[${specPtsStance}]}
          UIElement[SpecPtsStance@SpecPtsFrame@SpecPts@ClassTabs@ClassFrame@Class@EZVGTabs@ezvg]:SetSelection[${UIElement[BurnStance@OptionsStanceFrame@Stance@OptionsTabs@OptionsFrame@Options@EZVGTabs@ezvg].Items}]
      
      }
      iterInt:Inc[1]
    }
    while ${iterInt}<=${Me.Form}
  }
    
  
  ;############# SET UP abilBook ###############
  if ${Me.Class.Equal[Bard]}
  {
    echo ### setting song dropdowns for Bards
    iterCnt:Set[1]
    for (iterCnt:Set[1] ; ${iterCnt} <= ${Songs} ; iterCnt:Inc)
    {
      if ${Songs[${iterCnt}].Name.Length}>0
      {
        UIElement[CombatSong@ClassSongsFrame@Songs@ClassTabs@ClassFrame@Class@EZVGTabs@ezvg]:AddItem[${Songs[${iterCnt}].Name}]
        if ${Songs[${iterCnt}].Name.Equal[${combatSong}]}
          UIElement[CombatSong@ClassSongsFrame@Songs@ClassTabs@ClassFrame@Class@EZVGTabs@ezvg]:SetSelection[${UIElement[CombatSong@ClassSongsFrame@Songs@ClassTabs@ClassFrame@Class@EZVGTabs@ezvg].Items}]
        UIElement[NonCombatSong@ClassSongsFrame@Songs@ClassTabs@ClassFrame@Class@EZVGTabs@ezvg]:AddItem[${Songs[${iterCnt}].Name}]
        if ${Songs[${iterCnt}].Name.Equal[${nonCombatSong}]}
          UIElement[NonCombatSong@ClassSongsFrame@Songs@ClassTabs@ClassFrame@Class@EZVGTabs@ezvg]:SetSelection[${UIElement[NonCombatSong@ClassSongsFrame@Songs@ClassTabs@ClassFrame@Class@EZVGTabs@ezvg].Items}]
        UIElement[MoveSong@ClassSongsFrame@Songs@ClassTabs@ClassFrame@Class@EZVGTabs@ezvg]:AddItem[${Songs[${iterCnt}].Name}]
        if ${Songs[${iterCnt}].Name.Equal[${moveSong}]}
          UIElement[MoveSong@ClassSongsFrame@Songs@ClassTabs@ClassFrame@Class@EZVGTabs@ezvg]:SetSelection[${UIElement[MoveSong@ClassSongsFrame@Songs@ClassTabs@ClassFrame@Class@EZVGTabs@ezvg].Items}]
      }
    }
  }
}

function AllAbilCombos()
{
  echo --- populating all ability UI drop down boxes
  call PopulateComboBox "CustomSpellLineAbilCombo@CustomAbilitiesSpellLinesFrame@Spell Lines and Timers@CustomAbilitiesTabs@CustomAbilitiesFrame@Abilities@CustomTabs@CustomFrame@Custom@EZVGTabs@ezvg" "all" ""
  call PopulateComboBox "CustomTimerAbilityCombo@CustomAbilitiesSpellLinesFrame@Spell Lines and Timers@CustomAbilitiesTabs@CustomAbilitiesFrame@Abilities@CustomTabs@CustomFrame@Custom@EZVGTabs@ezvg" "all" ""
  call PopulateComboBox "CombatRezComboBox@OptionsHealFrame@Heal@OptionsTabs@OptionsFrame@Options@EZVGTabs@ezvg" "rez" "${combatRez}"
  call PopulateComboBox "NonCombatRezComboBox@OptionsHealFrame@Heal@OptionsTabs@OptionsFrame@Options@EZVGTabs@ezvg" "rez" "${nonCombatRez}"
  call PopulateComboBox "KillingBlowComboBox@OptionsDetrFrame@Detr@OptionsTabs@OptionsFrame@Options@EZVGTabs@ezvg" "detr" "${killingBlow}"
  call PopulateComboBox "BurnAbilTrigger@OptionsBurnFrame@Burn@OptionsTabs@OptionsFrame@Options@EZVGTabs@ezvg" "detr" "${burnTrigger}"
  call PopulateComboBox "BurnBuffTrigger@OptionsBurnFrame@Burn@OptionsTabs@OptionsFrame@Options@EZVGTabs@ezvg" "bene" "${burnBuffTrigger}"
  call PopulateComboBox "SummonMinion@OptionsPetFrame@Pet@ClassTabs@ClassFrame@Class@EZVGTabs@ezvg" "all" "${summonMinion}"
  call PopulateComboBox "SummonPet@OptionsPetFrame@Pet@ClassTabs@ClassFrame@Class@EZVGTabs@ezvg" "all" "${summonPet}"
  ;call PopulateComboBox "" "" ${}
  if ${Me.Class.Equal[Bard]} || ${Me.Class.Equal[Dread Knight]} || ${Me.Class.Equal[Psionicist]} || ${Me.Class.Equal[Sorcerer]}
    call PopulateComboBox "StripEnchantment@TgtBuffsFrame@TgtBuffs@ClassTabs@ClassFrame@Class@EZVGTabs@ezvg" "detr" "${stripEnchantment}"
  if ${Me.Class.Equal[Disciple]} || ${Me.Class.Equal[Monk]} || ${Me.Class.Equal[Warrior]} || ${Me.Class.Equal[Ranger]}
    call PopulateComboBox "StancePush@TgtBuffsFrame@TgtBuffs@ClassTabs@ClassFrame@Class@EZVGTabs@ezvg" "detr" "${stancePush}"
}

function PopulateComboBox(string loc, string abilType, string abilToSel)
{
  variable int iterCnt
  for (iterCnt:Set[1] ; ${iterCnt} <= ${Me.Ability} ; iterCnt:Inc)
  {
    if ${Me.Ability[${iterCnt}].TargetType.Equal[Player Corpse]} && ${abilType.Equal[rez]}
      UIElement[${loc}]:AddItem[${Me.Ability[${iterCnt}].Name}]
    elseif ${Me.Ability[${iterCnt}].TargetType.Equal[Offensive]} && ( ${abilType.Equal[all]} || ${abilType.Equal[detr]} )
      UIElement[${loc}]:AddItem[${Me.Ability[${iterCnt}].Name}]
    elseif !${abilType.Equal[detr]}
      UIElement[${loc}]:AddItem[${Me.Ability[${iterCnt}].Name}]
    if ${abilToSel.Equal[${Me.Ability[${iterCnt}].Name}]}
      UIElement[${loc}]:SetSelection[${UIElement[${loc}].Items}]
  }
  if ${Me.HavePet}
  {
    for (iterCnt:Set[1] ; ${iterCnt} <= ${Me.Pet.Ability} ; iterCnt:Inc)
    {
      UIElement[${loc}]:AddItem[${Me.Pet.Ability[${iterCnt}].Name}]
      if ${abilToSel.Equal[${Me.Pet.Ability[${iterCnt}].Name}]}
        UIElement[${loc}]:SetSelection[${UIElement[${loc}].Items}]
    }
  }
  if !${UIElement[${loc}].ItemByText[${abilToSel}](exists)} && ${abilToSel.Length}>0 && !${abilToSel.Equal[NULL]}
  {
    UIElement[${loc}]:AddItem[${abilToSel}]
    UIElement[${loc}]:SetSelection[${UIElement[${loc}].Items}]
  }
}